{% macro render_problem_title(pdoc, tdoc=none, show_tags=true,
show_invisible_flag=true, invalid=false, inline=false, show_pid=true,
small=false, alphabetic=false) %} {%- if not invalid -%} {% set _linkArgs = {
pid:pdoc.pid|default(pdoc.docId) } %} {% if tdoc %}{{ set(_linkArgs, 'query',
{tid:tdoc.docId}) }}{% endif %}
<a
  href="{{ url('problem_detail', _linkArgs) }}"
  {%
  if
  small
  %}
  data-tooltip="{{ pdoc.title }}"
  {%
  endif
  %}
>
  {%- endif -%} {% if show_pid %}
  <b
    >{%- if tdoc and alphabetic -%}{{
    String.fromCharCode(65+tdoc.pids.indexOf(pdoc.docId)) }} {%- elif pdoc.pid
    and pdoc.pid.includes('-') -%}{{ pdoc.pid.split('-').join('#') }} {%- else
    -%}{{ pdoc.pid|default(pdoc.docId) }}{%- endif -%}</b
  >
  {% endif %} {%- if not small -%}{% if show_pid %}&nbsp;&nbsp;{% endif %}{{
  pdoc.title }}{%- endif -%} {%- if not invalid -%}
</a>
{%- endif -%} {%- if pdoc.hidden and show_invisible_flag -%}
<span class="text-orange">({{ _('Hidden') }})</span>
{%- endif -%} {%- if show_tags -%}{{ render_problem_tags(pdoc, inline=inline)
}}{%- endif -%} {% endmacro %} {% macro render_problem_tags(pdoc,
show_none_label=false, inline=false) %} {%- if pdoc.tag|length > 0 %} {% set
diffItems
=["入门","普及-","普及/提高-","普及+/提高","提高+/省选-","省选/NOI-","NOI/NOI+/CTSC"]
%} {% set _items = "" %} {% set
tagclass={"入门":"#fe4c61","普及-":"#f39c11","普及/提高-":"#ffc116","普及+/提高":"#52c41a","提高+/省选-":"#3498db","省选/NOI-":"#9d3dcf","NOI/NOI+/CTSC":"#0e1d69"}
%} {%- if not inline %}
<ul class="problem__tags">
  {% endif -%} {%- for tag in pdoc['tag'] %} {%- if tag in diffItems -%} {% set
  _items = tagclass[tag] %} {%- endif -%} {% set _w = '"' if tag and
  tag.includes(' ') else '' %}

  <li class="problem__tag">
    <a
      class="problem__tag-link"
      {%
      if
      _items
      %}
      style="background-color: {{ _items }} !important;color:white !important;"
      {%
      set
      _items=""
      %}
      {%
      endif
      %}
      href="{{ url('problem_main', query={q:'category:'+_w+tag+_w}) }}"
      >{{ tag }}</a
    >
  </li>
  {%- endfor -%} {%- if not inline %}
</ul>
{% endif -%} {%- else -%} {%- if show_none_label -%}{{ _('(None)') }}{%- endif
-%} {%- endif -%} {% endmacro %}
